package com.pattern.facade;

/**
 * @author Mr.yuan
 * @version v1.0
 * @date 2019/8/2 13:59
 **/
public class FacadePattern {
    public static void main(String[] args) {
        ShapeMaker maker = new ShapeMaker();
        maker.drawCircle();
        maker.drawSquare();
        maker.drawRectangle();
    }
    private interface Shape{
        void draw();
    }
    private static class Circle implements Shape{
        @Override
        public void draw() {
            System.out.println("draw::circle()");
        }
    }
    private static class Rectangle implements Shape{
        @Override
        public void draw() {
            System.out.println("draw::rectangle()");
        }
    }
    private static class Square implements Shape{
        @Override
        public void draw() {
            System.out.println("draw::square()");
        }
    }

    private static class ShapeMaker{
        private Shape circle,square,rectangle;

        ShapeMaker() {
            this.circle = new Circle();
            this.square = new Square();
            this.rectangle = new Rectangle();
        }
        private void drawCircle(){
            circle.draw();
        }
        private void drawSquare(){
            square.draw();
        }
        private void drawRectangle(){
            rectangle.draw();
        }
    }
}
